<%-- 
    Document   : Judge
    Created on : 2019-6-16, 9:30:02
    Author     : 虎
--%>

<%@page import="com.jdbc.domains.User"%>
<%@page import="java.util.List"%>
<%@page import="com.jdbc.dao.impl.UserDaoImpl"%>
<%@page import="com.jdbc.daos.UserDao"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>个人信息管理系统--登录判断页面</title>
    </head>
    <body>
<%
    String username=request.getParameter("userName");
    String passwords=request.getParameter("password");
    UserDao dao = new UserDaoImpl();
    List<User> allUser= dao.listAll();
    boolean flag=false;
    session.setAttribute("userName", username);
    for(User u1 : allUser){
        if(username.equals(u1.getUserID())){
            flag=true;
            if(passwords.equals(u1.getPassword())){
                response.sendRedirect("../LoginSuccess/LoginSuccess.jsp");
            }else{
%>
                <p align="center">Sorry!密码输入错误！</p>
<%
            }
            break;
        }
    }
    if(flag==false){
%>
                <p align="center">Sorry!没有该用户！</p>
<%
    }
%>
    </body>
</html>
